<template>
<div>

</div>
</template>

<script>
  import axios from "axios";
  export default {
    name: "foot",
    data() {
      return {
      };
    },
    created() {
        this.checkmoney()
    },
    methods: {
      checkmoney(){
        var that = this
        axios.get('/api/gth/shop/balance')
        .then(response => {
            if(response && response.data.msg.code != 0){
                if(response.data.msg.code == 50401){
                  that.$router.push({ path: "/login" });
                  return false
                }else{
                  if(response){
                    that.$message.error(response.data.msg.info);
                  }
                }
            }else{
              if(response){
                if(parseFloat(response.data.data.balance) < 0){
                  that.open()
                }
              }
            }

        })
      },
      open() {
        var that = this
        this.$confirm('账户余额不足, 是否前往充值?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          that.$router.push({ path: "/wodezhanghu/wodezhanghu" });
        }).catch(() => {
        });
      }
    }
  };
</script>

<style>
</style>
